/**
 */
package com.pro.db.util;

import java.util.Collection;
import java.util.Map;

/**
 * Description: 集合工具类<br/>
 *
 * @author wanglei
 * @date: 2016年12月20日 上午9:21:49
 * @version 1.0
 * @since JDK 1.8
 */
public final class CollectionUtils {

    private CollectionUtils(){
    }

    public static boolean isEmpty(Collection<?> col) {
        return null == col || col.isEmpty();
    }

    public static boolean isNotEmpty(Collection<?> col) {
        return !isEmpty(col);
    }

    public static boolean isEmpty(Map<?, ?> map) {
        return null == map || map.isEmpty();
    }

    public static boolean isNotEmpty(Map<?, ?> map) {
        return !isEmpty(map);
    }

    /**初始化map的容量、减少扩容影响*/
    public static int capacitySize(int expectedSize) {
        if (expectedSize < 3) return expectedSize + 1;
        return (int) ((float) expectedSize / 0.75F + 1.0F);
    }
}
